🌎 rns.kin.earth git 🌍
Commit 2b79db03c0fa2d3775c45d80212ded682deec9bb
Parents : 2c9edc4
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-20T12:57:49+02:00
Added invalid discovery stamp cache
Changes
Diff
diff --git a/RNS/Discovery.py b/RNS/Discovery.py
index e6a479df..81d4ac0b 100644
--- a/RNS/Discovery.py
+++ b/RNS/Discovery.py
@@ -8,6 +8,7 @@ import ipaddress
import subprocess
from threading import Lock
from .vendor import umsgpack as msgpack
+from collections import deque
NAME = 0xFF
TRANSPORT_ID = 0xFE
@@ -228,6 +229,7 @@ class InterfaceAnnounceHandler:
self.required_value = required_value
self.callback = callback
self.stamper = LXStamper
+ self.invalid_cache = deque(maxlen=2048)
@staticmethod
def sanitize_name(name):
@@ -250,6 +252,11 @@ class InterfaceAnnounceHandler:
app_data = app_data[1:]
signed = flags & self.FLAG_SIGNED
encrypted = flags & self.FLAG_ENCRYPTED
+ fullhash = RNS.Identity.full_hash(app_data)
+
+ if fullhash in self.invalid_cache:
+ RNS.log(f"Ignored previously discovered interface with insufficient stamp value", RNS.LOG_PATHING) if RNS.sl(RNS.LOG_PATHING) else None
+ return
if encrypted:
if not RNS.Transport.has_network_identity(): return
@@ -265,6 +272,7 @@ class InterfaceAnnounceHandler:
if not valid:
RNS.log(f"Ignored discovered interface with insufficient stamp value {value}", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
+ self.invalid_cache.append(fullhash)
return
if value < self.required_value: RNS.log(f"Ignored discovered interface with stamp value {value}", RNS.LOG_DEBUG)
Served by rngit 1.4.2 - Generated in 0.05s